package com.yanqu.road.server.gameplayer.module.activity.tomb.cmd;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.tomb.Tomb;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.tomb.TombMgr;
import com.yanqu.road.server.gameplayer.module.activity.tomb.TombModule;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.GameErrorCode;
import com.yanqu.road.server.protocol.GameProtocol;

@Cmd(code = GameProtocol.S_TOMB_GET_USER_RELIC_DATA, desc = "秦始皇陵地宫遗物本次记录")
public class TombGetRelicHistoryCmd extends AbstractCommand {
    private Tomb.SyncUserRelicInfoResp.Builder respBuilder;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        this.respBuilder = Tomb.SyncUserRelicInfoResp.newBuilder();
        ActivityInfo activityInfo = TombMgr.getActivityInfo();
        if (activityInfo == null) {
            this.respBuilder.setRet(GameErrorCode.E_ACTIVITY_NOT_OPEN);
            player.sendPacket(ClientProtocol.U_TOMB_GET_USER_RELIC_DATA, this.respBuilder);
            return;
        }
        this.respBuilder = player.getModule(TombModule.class).getUserRelicSync();
        player.sendPacket(ClientProtocol.U_TOMB_GET_USER_RELIC_DATA, this.respBuilder);
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
